package com.hangjiang.gulidear.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

/**
 * Configchange entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "configchange", catalog = "sqm")
public class ConfigChange extends BaseEntity {

	// Fields

	private String changeId;
	private Task task;
	private Project project;
	private User user;
	private ConfigItem configItem;
	private String changeDescribe;
	private Date changeTime;
	private String attachPath;
	private double changeVersion;
	private Integer status;
	private Integer isDelete;
	private Set<ChangeAudit> changeaudits = new HashSet<ChangeAudit>(0);

	// Constructors

	/** default constructor */
	public ConfigChange() {
	}

	/** full constructor */
	public ConfigChange(Task task, Project project, User user,
			ConfigItem configItem, String changeDescribe, 
			Date changeTime, String attachPath, double changeVersion, 
			Integer status, Integer isDelete) {
		this.task = task;
		this.project = project;
		this.user = user;
		this.configItem = configItem;
		this.changeDescribe = changeDescribe;
		this.changeTime = changeTime;
		this.attachPath = attachPath;
		this.changeVersion = changeVersion;
		this.status = status;
		this.isDelete = isDelete;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "changeId", unique = true, nullable = false, length = 32)
	public String getChangeId() {
		return this.changeId;
	}

	public void setChangeId(String changeId) {
		this.changeId = changeId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "taskId")
	public Task getTask() {
		return this.task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "projId")
	public Project getProject() {
		return this.project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "configId")
	public ConfigItem getConfigItem() {
		return this.configItem;
	}

	public void setConfigItem(ConfigItem configItem) {
		this.configItem = configItem;
	}
	
	@Column(name = "changeDescribe")
	public String getChangeDescribe() {
		return this.changeDescribe;
	}

	public void setChangeDescribe(String changeDescribe) {
		this.changeDescribe = changeDescribe;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "changeTime", length = 0)
	public Date getChangeTime() {
		return this.changeTime;
	}

	public void setChangeTime(Date changeTime) {
		this.changeTime = changeTime;
	}

	@Column(name = "attachPath")
	public String getAttachPath() {
		return this.attachPath;
	}

	public void setAttachPath(String attachPath) {
		this.attachPath = attachPath;
	}

	@Column(name = "changeVersion", precision = 5 ,scale = 3)
	public double getChangeVersion() {
		return this.changeVersion;
	}

	public void setChangeVersion(double changeVersion) {
		this.changeVersion = changeVersion;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Column(name = "isDelete")
	public Integer getIsDelete() {
		return this.isDelete;
	}

	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "configchange")
	public Set<ChangeAudit> getChangeaudits() {
		return this.changeaudits;
	}

	public void setChangeaudits(Set<ChangeAudit> changeaudits) {
		this.changeaudits = changeaudits;
	}

}